package com.compty.paint.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 结算记录
 * @author 朱庆辉
 */
@Entity
@Table(name = "t_transaction_record")
public class TransactionRecord {
	
	private Long id;
	
	private int goods_id;//商品ID
	private String painting_name;//作品名称
	
	private float deal_price;//成交价格
	private Date deal_time;//成交时间
	private float ratio;//结算比例
	
	private int deal_status;//结算状态 
	private String dealStatus;//结算状态字符串表示
	
	private Date dealFinishedTime;//结算完成时间
	
	private float money_amount;//结算金额
	
	private Goods goods;
	
	private Long userId;//结算用户

	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column( name = "goods_id" )
	public int getGoods_id() {
		return goods_id;
	}

	public void setGoods_id(int goods_id) {
		this.goods_id = goods_id;
	}

	@Column( name = "painting_name",length = 150)
	public String getPainting_name() {
		return painting_name;
	}

	public void setPainting_name(String paintingName) {
		painting_name = paintingName;
	}

	@Column( name = "deal_price" )
	public float getDeal_price() {
		return deal_price;
	}

	public void setDeal_price(float deal_price) {
		this.deal_price = deal_price;
	}

	@Column( name = "deal_time" )
	public Date getDeal_time() {
		return deal_time;
	}

	public void setDeal_time(Date deal_time) {
		this.deal_time = deal_time;
	}

	@Column( name = "ratio" )
	public float getRatio() {
		return ratio;
	}

	public void setRatio(float ratio) {
		this.ratio = ratio;
	}

	@Column( name = "deal_status" )
	public int getDeal_status() {
		return deal_status;
	}

	public void setDeal_status(int deal_status) {
		this.deal_status = deal_status;
	}

	@Transient
	public String getDealStatus() {
		
		if(deal_status == 0) this.dealStatus = "初始化";
		if(deal_status == 1) this.dealStatus = "未结";
		if(deal_status == 2) this.dealStatus = "已结";
		
		return dealStatus;
	}

	public void setDealStatus(String dealStatus) {
		this.dealStatus = dealStatus;
	}

	@Column( name = "deal_finished_time" )
	public Date getDealFinishedTime() {
		return dealFinishedTime;
	}

	public void setDealFinishedTime(Date dealFinishedTime) {
		this.dealFinishedTime = dealFinishedTime;
	}

	@Column( name = "money_amount" )
	public float getMoney_amount() {
		return money_amount;
	}

	public void setMoney_amount(float money_amount) {
		this.money_amount = money_amount;
	}

	@Transient
	public Goods getGoods() {
		return goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	@Column( name = "userid" )
	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

}
